<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var a = true + false; // 1  :  非Number类型值运算时，会先转成number
        a = 1 + null; // 1
        a = 1 + NaN; //NaN   任何值和NaN做运算都等于NaN
        a = "123" + "4"; // 1234  如果两个字符串加法运算，会进行拼接操作
        a = 1 + "123" // 1123  任何值和字符串相加，都先转成字符串，再拼串
        a = true + 'niho'; // trueniho

        a = 100 - true; // 99
        a = 100 - "1" // 99

        a = 2 * "8" // 16
        a = 2 * undefined // NaN  : undefined 转nubmer值为NaN
        a = 2 * null; // 0

        //如何值做 - * / 运算时都会转成number
        console.log(a);
        console.log(typeof a);
    </script>
</body>

</html>